public class Homework {
    private int[] money = {50, 20, 10, 5, 5, 1, 1, 1};

    public boolean isTakeOut(int pay) {
        boolean flag = false;
        for (int i = 0; i < money.length; i++) {
            if (pay >= money[i]) {
                pay = pay - money[i];
            }
            if (pay == 0){
                return true;
            }
        }
        return  flag;
    }
}
